package com.impress.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.impress.R;
import com.impress.Utility;
import com.impress.model.Item;

public class BriefItemsAdapter extends BaseItemsListAdapter {

	public BriefItemsAdapter(Context context, List<Item> items) {
		super(context, items);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Item item = mItems.get(position);
		ViewHolder holder;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(R.layout.item_snippet, null);
			holder.itemSummaryContent = (TextView)convertView.findViewById(R.id.item_summary_content);
			holder.itemSummaryTitle = (TextView)convertView.findViewById(R.id.item_summary_title);
			convertView.setTag(holder);
		}else {
			holder = (ViewHolder)convertView.getTag();
		}
		holder.itemSummaryTitle.setText(Utility.trimString(item.getTitle(), 70));
		holder.itemSummaryContent.setText(item.getSummary());
		return convertView;
	}
	
	class ViewHolder{
//		View itemSnippet;
//		RelativeLayout itemSummary;
		TextView itemSummaryTitle;
		TextView itemSummaryContent;
		TextView textView;
	}

}
